<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.is.control.*" %>
<%@ page import="com.is.model.*" %>
<%@page import="com.is.util.ParamUtil"%>
<%@page import="java.util.List"%>
<%@page import="com.is.util.DateTime"%>
<%@page import="com.is.util.DesData"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/InterStu/resources/image/favicon.ico" />
<link rel="stylesheet" type="text/css" href="../../resources/css/all.css" />
<link rel="stylesheet" type="text/css" href="../../resources/css/add.css" />
<link href="../../resources/css/uploadify.css" rel="stylesheet" type="text/css" />
<link href="../../resources/css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../resources/js/popUpWin.js"></script>
<script type="text/javascript" src="../../resources/js/WebCalendar.js"></script>
<script type="text/javascript" src="../../resources/js/jquery-1.8.1.js"></script>
<script type="text/javascript" src="../../resources/js/swfobject.js"></script>
<script type="text/javascript" src="../../resources/js/jquery.artDialog.js"></script>
<script type="text/javascript" src="../../resources/js/iframeTools.js"></script>
<script type="text/javascript" src="../../resources/js/jquery.uploadify.v2.0.3.min.js"></script>
<script type="text/javascript" src="../../resources/js/jquery.lazyload.js"></script>
<script type="text/javascript">
	$(function(){
		(function (config) {
		    config['fixed'] = true;
		    config['okVal'] = '确定';
		    config['cancelVal'] = '取消';
			config['skin'] = 'default';
			config['drag'] = 'true';
		    // [more..]
		})(art.dialog.defaults);
            $("#uploadify").uploadify({
                'uploader'       : '../../resources/image/uploadify.swf',
                'script'         : '/InterStu/servlet/fileUpload',
                'cancelImg'      : '../../resources/image/cancel.png',
                'queueID'        : 'fileQueue',
                'auto'           : false,
                'multi'          : false,
                'buttonText'     : 'Browse file',
                            
	            onComplete: function (evt, queueID, fileObj, response, data) {
					$('<li></li>').appendTo('.files').text(response);
					var reg = /%20/g;
					var node = response + "";
        			var path = node.substring(node.indexOf("：")+1).replace(/\s*COMPOLETE\s*/gi,"");
        			var name = node.substring(0,node.indexOf("："));
        			var urls = "/InterStu/uploads/resourses/" + name + "/" + encodeURIComponent(path);
        			document.getElementsByName(name)[0].value= urls;
        			var tem ="." + name;
        			$(tem).attr('src',urls);
				},
				onError: function(a, b, c, d) {
		             alert("文件上传失败");
       			}
            });
			$("#info").submit(function(){
				$("#duration").val($("#duration1").val() + "至" + $("#duration2").val());
			});
			$(".mainContainer").hide();
			$("#addbtn").click(function(){
				$.dialog({ 
				title: "上传附件",
				width: "508px",
			 	content: document.getElementById("idd"),  
			 	cancelVal: '关闭',
    			cancel: true  
			})
			})
		var block = $("#magic_block");
		if($(".active a").position()){
			block.css("top",$(".active a").position().top+10)
			.data("oriTop",$(".active a").position().top)
		}
		$(".nav ul li").find("a").hover(
			function(){
				var $this = $(this);
				var newTop = $this.position().top;
				block.stop().animate({
					top:newTop+10
				})
			},
			function(){
				block.stop().animate({
					top:block.data("oriTop")+10
				})
			}
		)
		$("#update").hide();
		if($("[name='js_role']").val() == 1){
			$(".photo").hover(
				function(){
					$("#update").show();
				},
				function(){
					$("#update").hide();
				}
			)
		}
		var duration = $("#duration").val();
		var reg = /(\S+)至(\S+)/;
		var arr = reg.exec(duration);
		$("#duration1").val(arr[1]);
		$("#duration2").val(arr[2]);
		$("#info").submit(function(){
			$("#duration").val($("#duration1").val() + "至" + $("#duration2").val());
		});
		$(":text,.select").addClass("nontxt");
		if($("[name='js_role']").val() == 1){
			$(":text,.select").focus(function(){
				$(this).removeClass("nontxt");
			})
			.mouseover(function(){
				$(this).removeClass("nontxt");
			})
			.blur(function(){
				$(this).addClass("nontxt");
			})
			.mouseout(function(){
				$(this).addClass("nontxt");
			})
		} else{
			$(":text").attr("readonly","readonly");
			$(":text").click(function(){
				return false;
			})

		}
		$(".btns").css('cursor','pointer');
		$(".content").hide();
		$(".btns").click(function () {
		   $(this).next(".content").eq(0).toggle("slow");
		});
		setInterval(function(){
			var h = $('.right').height();
			$(".left").height(h);
		},100)
		$("img").lazyload({
		    threshold : 100,
		    placeholder : "../../resources/image/grey.gif",
		    effect : "fadeIn"
		});
		$('img').error(function(){
			this.src = "/InterStu/resources/image/man.GIF";
		})
		$(".update").click(function(){
			$.dialog.open("/InterStu/update_info.jsp",{width:460,height:400,title:"个人信息"});
		})
		$('img').error(function(){
			this.src = "/InterStu/resources/image/man.GIF";
		})
		$("[name='upload']").click(function(){
			var uploadUrl = $(this).attr("rel");
			$.dialog.confirm("提示：请用MicrosoftOffice word打开，部分版本打开时页面初始为web视图，<br>请在打开的文档菜单栏'视图'里面调整为页面视图！",
			function(){
				window.location = uploadUrl;
			},
			function(){
				
			}
			)
		})
	})
	function uploadifyUpload(){
		var category = $('#category').val();
		if(category=="0"){
			alert("请选择申请类别");
		}else{
			$('#uploadify').uploadifySettings('scriptData', {'category' : category});
  				$('#uploadify').uploadifyUpload();
		}   					
	}
</script>
<title>留学生预科班</title>
</head>
<% 
	User cu =(User)session.getAttribute("user"); 
	request.setCharacterEncoding("UTF-8");
	//int sid = ParamUtil.getInt(request,"sid");
	 DesData des = new DesData();
	int sid = Integer.parseInt(des.decrypt(ParamUtil.getString(request,"sid","0")));
	Student s = new Student();
	s = StudentControl.getStudent(sid);
	String defaultPicUrl="../../resources/image/man.GIF";
	String path = "../../User/UserHeadImage/";
	
%>
<body>
<div class="header">
	<div class="title pr">
    	<a href="javascript:void(0);"><span class="update pa">个人信息</span></a>
        <span class="logout pa"><a class="hide" href="/InterStu/login/logout.jsp">退出</a></span>
    </div>
</div>
<div class="main">
	<div class="left"> 
		<div class="infomation">
			<div class="photo">
			<%
				String picUrl = cu.getPicUrl();
			%>
				<img width='60' height="60" src = "<%=picUrl %>"  />
			</div>	
			<div class="welcome">
				<%=cu.getName() %>,<br/>
				欢迎您使用！
			</div>
		</div>   	
    	<div class="nav">
        	<ul>	
        		<li class="pa" id="magic_block"></li>
            <%if(cu!=null&&cu.getRole().equals("1")){ %>
                <li><a href="/InterStu/pages/stuyear/stuyear_start.jsp">新学期设置</a></li>
                <li><a href="/InterStu/pages/users/user_all.jsp">用户管理</a></li>
                <%} %>
                <li class="active"><a href="/InterStu/pages/students/student_add.jsp">学生管理</a></li>
                <li ><a href="/InterStu/pages/dictation/dictation_add.jsp">学生考核</a></li>
                <%if(cu!=null&&cu.getRole().equals("1")){ %>
                <li><a href="/InterStu/pages/assess/teacher_assess.jsp">教职人员管理</a></li>
                <%} %>
            </ul>
        </div>
    </div>
    <div class="right">
    	<div class="r1">
    	<table class="student tab">
    <tr>
    	 <%if(cu!=null&&cu.getRole().equals("1")){ %>
    	<td>
    		<a href="/InterStu/pages/students/student_add.jsp">添加学生</a>
		</td>
		<%} %>
		<td>
			<a class='current' href="/InterStu/pages/students/student_admin.jsp?id=<%=cu.getId() %>">查看学生</a>
		</td>
		<td>
			<a href="/InterStu/pages/attendance/attendance_add.jsp">学生出勤</a>
		</td>
    </tr>
    </table>
    	<form action='update_student_do.jsp?sid=<%=des.encrypt(sid+"") %>' id="info" method='post'>
    	<table border='1' class="table">
			<caption class="stu_inf pr">学生信息&nbsp;&nbsp;&nbsp;Information<span class="print pa"><a href="print.jsp?stu=<%=des.encrypt(sid+"") %>" target="_blank">打印信息</a>|<a href="javascript:void(0);" rel="word.jsp?stu=<%=des.encrypt(sid+"") %>" name="upload">下载文档</a> </span></caption>
			<tbody>
				<tr>
					<td>护照用名<br/>Passport Name<input type="hidden" value="<%=des.encrypt(sid+"") %>" name="stuid"/></td>
					<td colspan='2'><input type='text'  style="width:90%"  name='passportName' value="<%=s.getPassportName() %>"/> </td>
					<td>中文姓名<br/>Chinese Name</td>
					<td><input type='text' name='chineseName'  value='<%=s.getChineseName() %>'/></td>
				</tr>
				<tr>
					<td>国籍</td>
					<td><input type='text' name='nationality' value="<%=s.getNationality() %>" /></td>
					<td rowspan='2'>性别<br/>Sex</td>
					
					
					<td rowspan='2'>
					<%if(cu!=null&&cu.getRole().equals("1")){ %>
					<input type='radio' name='sex' value="1" <%=(s.getSex().equals("1"))?"checked":"" %> />男&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='sex'  <%=(s.getSex().equals("0"))?"checked":"" %> value="0"/>女
					<%}else{
						out.print(s.getSex().equals("1")?"男":"女");
					} %>
					</td>
					
					
					<td colspan='1' rowspan='6'>
						<div class="photo pr">
							<img id="imgs" src="<%=s.getPicPath() %>" width='150' height='150'/> 
							<a id="update" href="javascript:PopUpWindow('../../uploadimage.jsp',100,100,600,500);">修改照片</a>
						</div>
						<input type="hidden" id="updateImgs" name="picPath" value="<%=s.getPicPath()%>" />
					</td>
				</tr>
				<tr>
					<td>Nationality</td>
					<td><input type='text' name='nationalityEn' value="<%=s.getNationalityEn() %>"/></td>
				</tr>
				<tr>
					<td>出生日期<br/>Date of Birth</td>
					<td><input type='text' value="<%=s.getBirthday() %>"  <%if(cu!=null&&cu.getRole().equals("1")){ %>onclick="SelectDate(this,'','','yyyy-MM-dd')"readonly<%} %>  name="birthday"/></td>
					<td>班级<br/>Class</td>
					<td><%if(s.getClassId()!=null&&!s.getClassId().equals("")){ 
						         ParamClass  pc = ParamClassControl.getClassById(Integer.parseInt(s.getClassId()));
						          String  grade = pc==null?"":pc.getGrade();
						          if(grade!=null){
						        	  out.print(grade);
						          }
						}%>
					<%  if(cu!=null&&cu.getRole().equals("1")){ %>
					<select class="select" name="classId">
					<%
					   List<ParamClass> pcs = ParamClassControl.getParamClassesByStuyear(0);
					  for(ParamClass pc:pcs){
						%>
			           <option value="<%=pc.getId() %>" <%=(pc.getId() == Integer.parseInt(s.getClassId()))?"selected":"" %> ><%=pc.getClassName() %></option>
			
						<%
					}
					%>
					</select>
					<%}else{
						out.print(ParamClassControl.getClassName(Integer.parseInt(s.getClassId())));
					} %>
					</td>
				</tr>
				<tr>
					<td>护照号码<br/>Passport Number</td>
					<td><input type='text' value="<%=s.getPassportNumber() %>" name="passportNumber"/></td>
					<td>CSC 号</td>
					<td><input type='text' value="<%=s.getCscNumber() %>" name="CSCNumber"/></td>
				</tr>
				<tr>
					<td>经费办法<br/>Type of Scholarship</td>
					<td><input type='text' value="<%=s.getScholarshipType() %>" name='scholarshipType'/></td>
					<td>类别<br/>Level</td>
					<td><input value="<%=s.getLevel() %>" type='text' name='level'/></td>
				</tr>
				<tr>
					<td>专业院校<br/>University</td>
					<td><input type='text' value="<%=s.getUniversity() %>" name="university"/></td>
					<td>专业<br/>Major</td>
					<td colspan='1'><input value="<%=s.getMajor() %>" type='text' name='major'/></td>
				</tr>
				<tr>
					<td>学习时间<br/>Duration of Study</td>
					<td colspan="3"><input id="duration1" type='text' <%if(cu!=null&&cu.getRole().equals("1")){ %> onclick="SelectDate(this,'','','yyyy-MM-dd')" readonly <%} %> style="cursor:pointer;text-align:center;" />
					&nbsp;&nbsp;&nbsp;至&nbsp;&nbsp;&nbsp; 
					<input id="duration2" <%if(cu!=null&&cu.getRole().equals("1")){ %>onclick="SelectDate(this,'','','yyyy-MM-dd')"readonly<%} %> type='text'  style="cursor:pointer;text-align:center;" />
						<input type="hidden" id="duration" name="duration" value="<%=s.getDuration() %>"/>
					</td>
					<td>
						<%if(!cu.getRole().equals("") && cu.getRole().equals("1")){%>
						<input id="addbtn" type="button" value="修改附件"/>
						<%} %>
						<input type='hidden' value="<%=s.getVisaApplicationPath() %>" name='Application'/>
						<input type='hidden' value="<%=s.getAdmissionPath() %>" name='Admission'/>
						<input type='hidden' value="<%=s.getPassportPath() %>" name='Passport'/>
						<input type='hidden' value="<%=s.getChineseVisaPath() %>" name='ChineseVisa'/>
					</td>
				</tr>
				<tr>
				<td>
					其他
				</td>
				<td >
					<input type="text" name="type" value="<%=s.getType() %>" />
				</td>
				<td>
					备注
				</td>
				<td colspan="2">
					<input style="width:90%" type="text" value="<%=s.getTip() %>" name="tip" />
				</td>
			</tr>
			</tbody>
			</table>
			<p class="btns">外国留学人员来华签证申请表<br/>Visa Application for Study in China</p>
			<p class="content"><img height='824' width='695' src="<%=s.getVisaApplicationPath() %>" class='Application'/></p>
			<p class="btns">录取通知书<br/>Admission notice</p>
			<p class="content"><img  height='824' width='695'  src="<%=s.getAdmissionPath() %>" class='Admission' /></p>
			<p class="btns">护照<br/>Passport</p>
			<p class="content"><img  height='824' width='695'  src="<%=s.getPassportPath() %>"  class='Passport'/></p>
			<p class="btns">中华人民共和国签证<br/>Chinese Visa</p>
			<p class="content"><img  height='824' width='695'  src="<%=s.getChineseVisaPath() %>"  class='ChineseVisa'/></p>
			<% 
				if(!cu.getRole().equals("") && cu.getRole().equals("1")){
			%>
			<p style="height: 38px; line-height:38px;">&nbsp;
				<input type='submit' value='确定'/>
			</p>
			<%
				}
			%><input type="hidden" name="js_role" value="<%=cu.getRole() %>"/>
			<br/><br/><br/>
			</form>
        </div>
    </div>
</div>
<div class="mainContainer" id="idd">
				<div class="mainInfo">
					<p>
						<strong>操作流程说明：</strong><br/>
						1.选择类别<br/>
						2.点击"Browse file"按钮添加附件<br/>
						3.一次选择一个附件，加载成功后点击开始上传<br/>
						4.全部上传后，关闭窗口<br/>
					</p>
					<strong>注意：出于系统安全考虑，上传图片大小请不要超过1MB。</strong>
					<br/>
					类别：
					<select name="category" id="category">
						<option value="0">
							------请选择类别------
						</option>
			
						<option value="Application">外国留学人员来华签证申请表</option>
						<option value="Admission">录取通知书</option>
						<option value="Passport">护照</option>
						<option value="ChineseVisa">中华人民共和国签证</option>
			
					</select>
					<br/><br/>
					<input type="file" name="uploadify" id="uploadify" />		
					
					<div id="fileQueue"></div>
					<br/>
					<p>
						<a href="javascript:void(0);" class="btn" onClick="javascript:uploadifyUpload()">开始上传</a>&nbsp;
					</p>
					<p>
						
					</p>
					<ol class="files"></ol>
					</div>
			</div>
<div class="footer">
	<p>版权所有：东北师范大学留学生预科部&nbsp;&nbsp;  蓝旭工作室开发</p>
</div>
</body>
</html>